<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@include file="/common/jsp/common_header.jsp"%>
<html>
	<head>
		<title>donave Platform</title>
		<script>
	        var body_width=150;
	        var body_height=150;
   	    </script>
		<link
			href="<%=request.getContextPath()%>/ui/skin/donave/css/global.css"
			rel="stylesheet" type="text/css">
		<link
			href="<%=request.getContextPath()%>/ui/skin/donave/css/popdiv.css"
			rel="stylesheet" type="text/css">
		<link
			href="<%=request.getContextPath()%>/ui/skin/donave/jscalendar/calendar-win2k-cold-1.css"
			rel="stylesheet" type="text/css" media="all">

		<script type="text/javascript" language="java">
         function create() {
         	var columnId =$('#columnId').val();
         	 var  url= ctx+"/cms/cmscontent!goAddContent.action?columnId="+columnId;
         	  self.location=url;
         }
         function selectAll(checked) {
             var checkedboxes = document.getElementsByName("deleteids");
             for (var i = 0; i < checkedboxes.length; i++) {
                 checkedboxes[i].checked = checked;
             }
         }
         function getSelectItem(form) {
             var subGo = 0;
             var list = "";
             for (var i = 0; i < form.elements.length; i++) {
                 if (form.elements[i].type == "checkbox") {
                     if (form.elements[i].checked && form.elements[i].name != "selids") {
                         subGo++;
                         list += form.elements[i].value + ";";
                     }
                 }
             }
             if (subGo < 1) {
                 alert("您没有选择要操作的条目！");
                 return;
             }
             return list;
         }
         function remove(form) {
             var list = getSelectItem(form);
             if (list == null)
                 return;
             if (window.confirm("您确认删除吗？") == false)
             	 return;
             contentListForm.action=ctx+"/cms/cmscontent!deleteContents.action";
             contentListForm.submit();
         }

         function doModify(id) {
         	var columnId =$('#columnId').val();
             var url = ctx+"/cms/cmscontent!modifyContent.action?columnId=" + columnId + "&dnCmsContent.id=" + id;
            self.location=url;
         }
         
          function doPublic(contentId) {
	        if (window.confirm("信息即将发布，如果您不指定信息读者范围，则信息即为公共信息") == false)return;
	        var columnId = $("#columnId").val();
	        
	        if (confirm('您确认发布选定的信息吗？')) {
	            self.location =ctx+"/cms/cmscontent!publicContent.action?contentId=" + contentId+"&columnId="+columnId;
	        }
    }
    </script>
	</head>
	<table id="display" height="100%" width="100%">
		<tr>
			<td valign="top">
				<div id="layer1"
					style="width: 100%; height: 100%; z-index: 50; overflow: auto;">
					<table width="100%">

						<tr>
							<td valign="top" class='contentTd'>


								<!-- display a margin below tabpane-->
								<table width="100%" height="10">
									<tr>
										<td></td>
									</tr>
								</table>
								<s:form id="contentListForm" name="contentListForm"
									method="post" theme="simple">
									<s:hidden name="columnId" id="columnId"></s:hidden>
									<table width="100%" class="common_input_table">
										<tr align="center">
											<td  class="common_td_lable" width="5%">
												<input type="checkbox" id="selids" name="selids"
													onclick="selectAll(this.checked)"> 
											</td>
										
											<td  class="common_td_lable">
												<b>信息名称 
											</td>
											<td class="common_td_lable">
												<b>创建者 
											</td>
											<td class="common_td_lable">
												<b>创建时间 
											</td>
											<td colspan="2" class="common_td_lable" width="10%">
												<b>操作
											</td>
										</tr>
										<s:iterator value="contentList" status="rowstatus">
											<tr>
												<td width="20px" class="common_td_text_middle"> <s:property value="#rowstatus.count"/></td>
												<td class="common_td_text_left">
														<s:checkbox name="deleteids" fieldValue="%{id}"
															theme="simple" />
													<a href="#" onclick="doModify('<s:property value="id"/>')">
														<s:property value="title" /> </a>
												</td>
												<td class="common_td_text_left">
													<a href="#" onclick="doModify('<s:property value="id"/>')">
														<s:property value="creator" /> </a>
												</td>
												<td class="common_td_text_left">
													<s:property value="createTime" />
												</td>
												<td colspan="2" class="common_td_text_middle">
										            <a href="#" onclick="doPublic('<s:property value="id"/>')">
										                <img src="<%=request.getContextPath()%>/ui/skin/donave/images/reload.gif" border="0" alt="发布"/></a>
										        </td>
											</tr>
										</s:iterator>
									</table>
									<s:property value="pagedHTML" escape="false"/>
							</td>
						</tr>
					</table>
				</div>
			</td>
		</tr>
		<tr>
			<td height='24' valign='bottom'>
				<table width='100%'>
					<tr>
						<td class='footerTd'>
							&nbsp; &nbsp;
							<input type="button" class="button2" value="新建"
								onclick="create()">
							&nbsp; &nbsp;
							<input type="button" class="button2" value="删除"
								onclick="remove(this.form)">
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	</s:form>
	</body>
</html>
